package com.hl.web.fore;

import com.hl.pojo.CourseCollection;
import com.hl.service.CourseCollectionService;
import com.hl.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/courseCollection")
public class CourseCollectionController {
    @Autowired
    private CourseCollectionService courseCollectionService;

    @PostMapping("/add")
    public ResultEntity add(@RequestBody CourseCollection courseCollection){
        return ResultEntity.ok(courseCollectionService.add(courseCollection));

    }
    @PostMapping("/update")
    public ResultEntity update(@RequestBody CourseCollection courseCollection){
        return ResultEntity.ok(courseCollectionService.update(courseCollection));
    }

    @GetMapping("/del")
    public ResultEntity del(Integer id){
        return ResultEntity.ok(courseCollectionService.del(id));
    }

    @GetMapping("/findById")
    public ResultEntity findById(Integer id){
        return ResultEntity.ok(courseCollectionService.findById(id));
    }

    @GetMapping("/findAll")
    public ResultEntity findAll(){
        return ResultEntity.ok(courseCollectionService.findAll());
    }
}
